package com.sslite.dao;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.sslite.util.SSLiteProperties;
import com.sslite.util.Utility;

public class GoogleStockScreenerDao {
	public static void main(final String... args) throws Exception{
		getSymbols();
	}
	
	public static List<String> getSymbols() throws Exception{
		final String content = Utility.getContent( SSLiteProperties.GOOGLE_STOCK_SCREENER_URL.getValue() );
		final List<String> symbols = new ArrayList<String>();
		for( String line : content.split("\n") ){
			if( line.startsWith("\"ticker\"") ){
				String symbol = line.substring( 12, line.indexOf("\",") );
				if( symbol.indexOf("-") == -1 && symbol.indexOf(".") == -1 ){
					symbols.add( symbol );
				}
			}
		}
		System.out.println( "Total " +symbols.size()+ " symbols pulled from Google Stock Screener." );
		System.out.println( "All symbols: " +symbols );

		final List<String> amexList = new ArrayList(Arrays.asList("AAMC,AAU,ACCU,ACU,ACWV,ACY,ADGE,ADK,ADK-A,AE,AFK,AGA,AGEM,AGF,AGG,AGLS,AGOL,AGQ,AGX,AGZ,AIA,AJB,AKG,ALD,ALFA,ALN,ALTL,ALTV,AMCO,AMJ,AMLP,AMPE,AMPS,AMS,AMU,AND,ANGL,ANV,AOA,AOK,AOM,AOR,API,APP,APT,APTS,AQQ,ARGT,ARR.W,ASEA,ASM,ATL,ATMP,AUD,AUMN,AUNZ,AUSE,AVL,AWX,AXDI,AXHE,AXJL,AXN,AXTE,AXU,AXX,AYT,AZC,AZIA,BAA,BAB,BABS,BABZ,BAL,BBH,BBRC,BCM,BCV,BDCL,BDCS,BDD,BDR,BFOR,BFY,BHB,BHV,BIK,BIL,BIR-A,BIV,BIZD,BJK,BKF,BKJ,BKLN,BKR,BLE,BLJ,BLV,BND,BNO,BOIL,BOND,BONE,BPS,BQY,BRAF,BRAQ,BRAZ,BRD,BRF,BRN,BRXX,BRZS,BRZU,BSCD,BSCE,BSCF,BSCG,BSCH,BSCI,BSCJ,BSCK,BSCL,BSCM,BSJD,BSJE,BSJF,BSJG,BSJH,BSJI,BSJJ,BSJK,BSV,BTG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,VIIZ,VIOG,VIOO,VIOV,VIS,VIXM,VIXY,VKI,VMM,VNM,VNQ,VO,VOE,VOO,VOOG,VOOV,VOT,VOX,VPL,VPU,VQT,VRD,VSB,VSPY,VSR,VSS,VT,VTG,VTI,VTV,VUG,VV,VWO,VXF,VXX,VXZ,VYM,WDIV,WDTI,WEAT,WGA,WIP,WITE,WMCR,WMW,WPS,WREI,WRN,WTT,WYY,XAR,XBI,XES,XHB,XHE,XHS,XIV,XLB,XLE,XLF,XLG,XLI,XLK,XLP,XLU,XLV,XLY,XME,XMLV,XMPT,XOP,XOVR,XPH,XPL,XPP,XRA,XRT,XSD,XSLV,XSW,XTL,XTN,XVIX,XVZ,YANG,YAO,YCS,YINN,YMLI,YMLP,YXI,YYY,ZBB,ZIV,ZROZ,ZSL".split(",")));
		symbols.removeAll(amexList);
		System.out.println( "Total " +symbols.size()+ " symbols remaining after removing AMEX symbols." );
		System.out.println( "Symbols (after removing AMEX): " +symbols );
		return symbols;
	}
}
